<!--
* @Author: 张昊
* @Date:  2022-11-03 13:39:36
* @FilePath: /pages/index/src/recent/recent.vue
* @Description: 最新消息速递
-->
<template>
	<view>
		<!-- 公众号文章封面 -->
		<view class="officials">
			<view v-for="(item, index) in detailsItems" :key="index" class="official" @click="clickPoster(item)">
				<image mode="scaleToFill" class="official-img" :src="item.image" :alt="item.title"></image>
				<u-cell size="large" :title="item.title">
					<text slot="value" class="official-text">{{ $u.timeFormat(item.createtime, 'yyyy年mm月dd日') }}</text>
				</u-cell>
			</view>
		</view>
		<!-- 跳转小程序 -->
		<navigator class="btn" target="miniProgram" open-type="navigate" app-id="wx01bb1ef166cd3f4e" version="trial">
			<view class="gift"><u-icon @click="click" name="gift-fill" color="#ff3e5b" size="46"></u-icon></view>
		</navigator>
		
		<!-- 下拉刷新组件 -->
		<txt-pulldown :flagIn="flag"></txt-pulldown>
	</view>
</template>

<script>
import {
	gzhhuodong // 最新消息速递列表
} from '@/common/api.js';
import onReachBottom from '@/common/mixin/onReachBottom.js';
export default {
	mixins: [onReachBottom],
	data() {
		return {
			// 公众号图片
			detailsItems: []
		};
	},
	methods: {
		// 点击海报跳转
		clickPoster(item) {
			uni.navigateTo({
				url: '/pages/index/src/click-poster/click-poster?url=' + item.url
			});
		},
		async reqPaging() {
			let { data, total } = await gzhhuodong({ limit: 10, page: this.num });
			this.total = total;
			this.detailsItems = [...this.detailsItems, ...data];
		}
	}
};
</script>

<style lang="scss">
.officials {
	display: flex;
	flex-direction: column;

	.official {
		flex: 1;

		display: flex;
		flex-direction: column;
		margin: 28rpx 28rpx 0 28rpx;
		border-radius: 32rpx;
		background-color: #fff;
		.official-img {
			flex: 1;
			width: 100%;
			height: 277rpx;
		}
		.official-text {
			font-size: 20rpx;
			color: #717171;
		}
	}
}
.btn {
	margin: 28rpx;
}
.gift {
	width: 74 * 2rpx;
	height: 74 * 2rpx;
	position: fixed;
	top: 926rpx;
	right: 20rpx;
	background-color: #429EAC;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
}
</style>
